<template>
    <div>
        <a href="https://vite.dev" target="_blank">
            <img src="/vite.svg" class="logo" alt="Vite logo" />
        </a>
        <el-button type="primary">Primary Button</el-button>
        <!--        <el-icon><Edit /></el-icon>-->
        <SvgIcon name="cps" width="30px" height="30px"></SvgIcon>
        <a href="https://vuejs.org/" target="_blank">
            <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
        </a>
    </div>
    <HelloWorld msg="Vite + Vue" />
    <Test></Test>
    <div>
        <h1>kkkfff</h1>
    </div>
    <button @click="postData">POST 请求</button>
    <button @click="getUserInfo">获取用户信息</button>
</template>
<script setup lang="ts">
import axios from 'axios'
import { reqLogin, reqUserInfo } from '@/api/user/index.ts'

axios.get('/api/user').then((response) => {
    console.log(response.data)
})

async function postData() {
    return await reqLogin({
        username: 'admin',
        password: '123456',
    }).then((response) => {
        console.log(response.data.token)
        console.log(response.data.user)
    })
}
async function getUserInfo() {
    return await reqUserInfo().then((response) => {
        console.log(response)
    })
}

</script>

<style scoped lang="scss">
@use '@/styles/variable.scss' as *;

div {
    h1 {
        color: $color;
    }
}

.logo {
    height: 6em;
    padding: 1.5em;
    will-change: filter;
    transition: filter 300ms;
}

.logo:hover {
    filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
    filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
